package com.zhuozhou.jdyc.main.settlement.adapter;

import android.content.Context;

import com.bumptech.glide.Glide;
import com.zhuozhou.jdyc.R;
import com.zhuozhou.jdyc.base.BaseRecyclerViewAdapter;
import com.zhuozhou.jdyc.base.BaseViewHolder;
import com.zhuozhou.jdyc.databinding.SettlementShopItemItemBinding;
import com.zhuozhou.jdyc.main.main.bean.BasicsShoppingBean;
import com.zhuozhou.jdyc.util.apiUtil.NumberUtils;

/**
 * Create by Once_ChuXy on 2021/8/25
 * Describe:
 */
public class SettlementShopItemAdapter extends BaseRecyclerViewAdapter<BasicsShoppingBean.ObjBeanX.ObjBean.ShangpinBean, SettlementShopItemItemBinding> {

    public SettlementShopItemAdapter(Context context) {
        super(context);
    }

    int Distribution = 0;
    int type = 0;

    @Override
    protected int getLayoutId() {
        return R.layout.settlement_shop_item_item;
    }

    @Override
    public void onBindHolder(BaseViewHolder<SettlementShopItemItemBinding> holder, int pos) {
        Glide.with(mContext).load(mList.get(pos).getSpec_image()).into(holder.getBinding().imageMerchant);
        holder.getBinding().setBean(mList.get(pos));
        holder.getBinding().setPrice((type == 1 ? "" : type == 2 ? (mList.get(pos).getIntegral() + "积分+")
                : (mList.get(pos).getYibi() + "易货积分+")) + "￥" + mList.get(pos).getGoods_price());
        holder.getBinding().setFreight("--");
        switch (Distribution) {
            case 1:
                holder.getBinding().setFreight(NumberUtils.decimalFormat(mList.get(pos).getWuliu() + ""));
                break;
            case 2:
                holder.getBinding().setFreight("0.00");
                break;
            case 3:
                //闪送
                break;
            case 4:
                holder.getBinding().setFreight(NumberUtils.decimalFormat(mList.get(pos).getHuoyun() + ""));
                break;
        }
    }

    public void setDistribution(int Distribution) {
        this.Distribution = Distribution;
    }
    public void setType(int type) {
        this.type = type;
    }
}
